package boot.autoconfigure;

import com.jueyunqi.service.ExportService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.concurrent.CountDownLatch;

/**
 * Created by zhongwen on 2018/3/21.
 */
@SpringBootApplication
public class SpringBootMain {
    private static CountDownLatch countDownLatch = new CountDownLatch(1);

    public static void main(String[] args){
        run(SpringBootMain.class,args);
    }

    public static void run(Class<?> clazz,String[] args){
        ConfigurableApplicationContext ctx = SpringApplication.run(clazz,args);

        ExportService exportService = ctx.getBean(ExportService.class);
        exportService.run("hello aaa");
        System.out.println(exportService.doRun("hello "));

        if(ctx != null && ctx.isActive()) {
            try {
                countDownLatch.await();
            } catch (InterruptedException var8) {
                var8.printStackTrace();
            }
        }
    }
}
